function showDialogs (url,form_id,title,uclass,cname,module)
{
	window.top.art.dialog({id:form_id}).close();
	if(cname=="pic"){
    	 window.top.art.dialog.open(url+"?uclass="+uclass+"&module="+module,{id:form_id,title:title,width: '60%', height: '60%', left: '40%', top: '20%', fixed: true, resize: true, drag: true,lock:true ,
         cancel: true,
		 close: function () {
				this.hide();
		    }});
	}else{
	 window.top.art.dialog.open(url,{id:form_id,title:title,width: '50%', height: '60%', left: '50%', top: '20%', fixed: true, resize: false, drag: false,lock:true,
         okVal:"插入",
	 	ok: function ()

	{

		var iframe = this.iframe.contentWindow;
		if (!iframe.document.body) {
			alert('loading...');
			return false;
		};
        var result="";
        var aInput=[];
        var aTextarea=[];
        var aOption="";
		if(cname=="video"){
			allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择视频！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
				console.log(aInput[j].value);
	            if(aInput[j].value=="youku"){
	                   result+="<p style=\"text-align: center;\"><span id='"+aInput[j].id+"'><iframe frameborder=\"0\" scrolling=\"no\" src=\"https://so_v.ali213.net/plus/video.php?type=youku&vid="+aInput[j].id+"&pt=full\" style=\"height:328px;visibility:inherit;width:584px;z-index:1;overflow:visible;\"></iframe></span></p><p style=\"text-align: center;\"><a href='"+aInput[j].className+"' target='_blank'><font color=\"red\"><b>"+aInput[j].name+"</b></font></a></p>";
	            }else if(aInput[j].value=="letv"){
	            	result+="<p style=\"text-align: center;\"><embed align=\"middle\" allowfullscreen=\"true\" allowscriptaccess=\"always\" flashvars=\"uu=eltc9udnh2&amp;vu="+aInput[j].id+"&amp;pu=9ec7685ca4&amp;auto_play=0&amp;gpcflag=1&amp;width=600&amp;height=340&amp;lang=zh_CN\" height=\"340\" quality=\"high\" src=\"http://yuntv.letv.com/bcloud.swf\" type=\"application/x-shockwave-flash\" width=\"600\"></p><p style=\"text-align: center;\"><a href='"+aInput[j].className+"' target='_blank'><font color=\"red\"><b>"+aInput[j].name+"</b></font></a></p>";
	            }else if(aInput[j].value=="youkunew"){
	            	result+="<p style=\"text-align: center;\"><span id='"+aInput[j].id+"'><iframe frameborder=\"0\" scrolling=\"no\" src=\"https://so_v.ali213.net/plus/video.php?type=youkunew&vid="+aInput[j].id+"&pt=full\" style=\"height:328px;visibility:inherit;width:584px;z-index:1;overflow:visible;\"></iframe></span></p><p style=\"text-align: center;\"><a href='"+aInput[j].className+"' target='_blank'><font color=\"red\"><b>"+aInput[j].name+"</b></font></a></p>";
	            }else if(aInput[j].value=="bilibili"){
					result+="<p style=\"text-align: center;\"><span id='"+aInput[j].id+"'><iframe frameborder=\"0\" scrolling=\"no\" src=\"//player.bilibili.com/player.html?aid="+aInput[j].flash+"&cid="+aInput[j].id+"&page=1\" style=\"height:328px;visibility:inherit;width:584px;z-index:1;overflow:visible;\"></iframe></span></p><p style=\"text-align: center;\"><a href='"+aInput[j].className+"' target='_blank'><font color=\"red\"><b>"+aInput[j].name+"</b></font></a></p>";

				}else{
	                  result+="<p style=\"text-align: center;\"><span id='"+aInput[j].id+"'><iframe frameborder=\"0\" scrolling=\"no\" src=\"http://www.tudou.com.iyouxia.com/plus/video.php?type=tudou&vid="+aInput[j].id.substring(1)+"&pt=full\" style=\"height:328px;visibility:inherit;width:584px;z-index:1;overflow:visible;\"></iframe></p><p style=\"text-align: center;\"><a href='"+aInput[j].className+"' target='_blank'><font color=\"red\"><b>"+aInput[j].name+"</b></font></a></p>";
	            }

			}
			insertpagebreak(uclass,result);
			this.hide();
	    }else if(cname=="bzvideo"){
			allElements =iframe.document.getElementsByTagName("textarea");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].name=="vcode"){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择视频！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
	            result+='<p style="text-align: center;"><video autostart="false" controls="controls" loop="true" src="'+aInput[j].value.replace('<iframe','<iframe style="height:392px;visibility:inherit;width:584px;z-index:1;overflow:visible;"')+'" width="697">&nbsp;</video></p>';
			}
			insertpagebreak(uclass,result);
			this.hide();
	    }else if(cname=="table"){
		   allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择表格！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
			     result += aInput[j].value;
			}

			insertpagebreak(uclass,result);
			this.hide();
		}else if(cname=="review"){
            allInput =iframe.document.getElementsByTagName("input");
            allTextarea =iframe.document.getElementsByTagName("textarea");
            allOption =iframe.document.getElementsByTagName("option");
            for(var i=0;i<allInput.length;i++){
                aInput[allInput[i].name] = allInput[i].value;
            }
            for(var i=0;i<allTextarea.length;i++){
                aTextarea[allTextarea[i].name] = allTextarea[i].value;
            }
            for(var i=0;i<allOption.length;i++){
                if (allOption[i].selected==true){
                    aOption = allOption[i].value;
                }
            }

            if (aOption == 1){
                result += '<div class="reviewOne">';
                result += '<div class="reviewOne_takeaway">'+aTextarea['takeaway']+'</div>';
                result += '<div class="reviewOne_con"><p style="text-align: center;"><img src="'+aInput['mOne_pic1']+'" style="max-width:800px;" /></p>';
                for(var i=1;i<6;i++){
                    if (aInput['mOne_jg'+i] && aInput['mOne_pf'+i] && aTextarea['mOne_pj'+i] ){
                        result += '<div class="reviewOne_pf"><span class="reviewOne_pfjg">'+aInput['mOne_jg'+i]+'评测</span><span class="reviewOne_pfsz">'+aInput['mOne_pf'+i]+'</span></div>';
                        result += '<p style="text-align: center;">'+aTextarea['mOne_pj'+i]+'</p>';
                    }
                }
                result += '<p style="text-align: center;"><img src="'+aInput['mOne_pic2']+'" style="max-width:800px;" /></p>';
                result += '</div></div>';
            }else if(aOption == 2){
                result += '<div class="reviewTwo">';
                result += '<div class="reviewTwo_takeaway"><span class="reviewTwo_takeawayLeft">游戏评测</span><div class="yjtitlbcon">'+aTextarea['takeaway']+'</div></div>';
                result += '<p style="text-align: center;"><img src="'+aInput['mTwo_pic1']+'" style="max-width:800px;" /></p>';
                result += '<p>'+aInput['mTwo_picInfo']+'</p>';
                result += '<div class="reviewTwo_yxyd"><span>游戏优点</span></div>';
                result += '<p>'+aTextarea['mTwo_gameAdvantage']+'</p>';
                result += '<p style="text-align: center;"><img src="'+aInput['mTwo_pic2']+'" style="max-width:800px;" /></p>';
                result += '<div class="reviewTwo_yxqd"><span>游戏缺点</span></div>';
                result += '<p>'+aTextarea['mTwo_gameDisAdvantage']+'</p>';
                result += '<div class="reviewTwo_ztpj">总体评价：</div>';
                result += '<p>'+aTextarea['mTwo_allpj']+'</p>';
                result += '<p style="text-align: center;"><img src="'+aInput['mTwo_pic3']+'" style="max-width:800px;" /></p>';
                result += '<div class="reviewTwo_pf">';
                for(var i=1;i<6;i++){
                	if (i==1 || i==4)result +='<div class="reviewBox">';
                    if (aInput['mTwo_jg'+i] && aInput['mTwo_pf'+i]){
                        result += '<div class="pftwo pf'+parseInt(aInput['mTwo_pf'+i])+'"><span class="pfjg">'+aInput['mTwo_jg'+i]+'评分</span><span class="pfsz">'+aInput['mTwo_pf'+i]+'</span></div>';
                    }
                    if (i==3 || i>5)result +='</div>';
                }
                result += '</div></div>';

            }
            insertpagebreak(uclass,result);
        }else if(cname=="idvideo"){
		   allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择视频！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
			     if(j==(aInput.length)-1){
				   result+=aInput[j].alt;
				 }else{
				   result+=aInput[j].alt+",";
				 }

			}

			$("."+uclass).val(result);
			//insertpagebreak(uclass,result);
			this.hide();
		}else if(cname=="idpic")
		{

			allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true)
				{
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择视频！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
               $("."+uclass).val(aInput[j].value);
			}
			this.hide();
	    }else if(cname=="hardwareidpic")
		{

			allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
				if(allElements[i].checked==true)
				{
					aInput.push(allElements[i]);
				}
			}
			if(aInput.length==0){
				alert("请选择图集！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
				$("."+uclass).val(aInput[j].value);
			}
			this.hide();
		}else if(cname=="newsid")
		{

			allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true)
				{
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择视频！");
				return false;
			}
			result="";
			for(var j=0;j<aInput.length;j++){

			     if(j==(aInput.length)-1){
				   result+=aInput[j].value;
				 }else{
				   result+=aInput[j].value+",";
				 }


			}
				$("."+uclass).val(result);
			this.hide();
	    }else if(cname=="special"){
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择要插入的内容！");
				return false;
			}
			var result1=result2='';
			for(var j=0;j<aInput.length;j++){
				if(aInput[j].name==1){
					result1+='<a target="_blank" href="'+aInput[j].value+'"><font style="color: #ff8a00">'+aInput[j].id+'专题</font></a>';
				}else if(aInput[j].name==2){
					result2+='<a target="_blank" href="'+aInput[j].value+'"><font style="color: #ff8a00">'+aInput[j].id+'论坛</font></a>';
				}else if(aInput[j].name==3){
					result+='<p class="n_show_b" style="text-align:left;"><script>var bid='+aInput[j].value+';</script></p>';
				}else if(aInput[j].name==4){
					result+='<p class="n_show_s" style="text-align:left;"><script>var sid='+aInput[j].value+';</script></p>';
				}
			}
			if(result1!='' || result2!='') result='<p style="text-align:left;"><span class="n_show_g"><strong>更多内容：</strong>'+result1+result2+'</span></p>'+result;
			insertpagebreak(uclass,result);
			this.hide();

	    }else if(cname=="syzt"){
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择要插入的专题！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){

				result+='<p class="n_show_m" style="text-align: left">更多相关资讯攻略请关注：<a target="_blank" href="'+aInput[j].value+'"><span style="color: #ff4800">'+aInput[j].id+'专题</span></a></p>';
			}
			insertpagebreak(uclass,result);
			this.hide();
	    }else if(cname=="h3"){
			allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择要插入的H3标签样式！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
				result+='<h3 class="h3_'+aInput[j].value+'"><strong>这里是H3标签的内容！</strong></h3>';
			}
			insertpagebreak(uclass,result);
			this.hide();
		}else if(cname=="sygame"){
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择要插入的游戏！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){

				result+=aInput[j].id+',';
			}
			insertpagebreak(uclass,result);
			this.hide();
	    }else if(cname=="gamecard"){
            allElements =iframe.document.getElementsByTagName("input");
            for(var i=0;i<allElements.length;i++){
                if(allElements[i].checked==true){
                    aInput.push(allElements[i]);
                }
            }
            if(aInput.length==0){
                alert("请选择要插入的游戏！");
                return false;
            }
            for(var j=0;j<aInput.length;j++){

                result+='[###]'+aInput[j].id+'_'+aInput[j].dataset.type+'[@@@]';
            }
            insertpagebreak(uclass,result);
            this.hide();
        }else if(cname=="oloday"){
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput=allElements[i];
              	}
			}
			$("."+uclass).val(aInput.value);
			this.hide();

	    }else if(cname=="indexpic"){

                  allElements =iframe.document.getElementsByTagName("a");
					for(var i=0;i<allElements.length;i++){
		              	if(allElements[i].className=="active"){
		                   	aInput.push(allElements[i]);
		              	}
					}
					if(aInput.length==0){
						alert("请选择图片！");
						return false;
					}
					for(var j=0;j<aInput.length;j++){

                          result+=aInput[j].id;
					}
			var aTag=document.getElementsByTagName("*");
			var obj=[];

			for(var i=0;i<aTag.length;i++){
		           if(aTag[i].className==uclass){
		           	     obj.push(aTag[i]);
		           }
			}
			obj[0].value=result;
			this.hide();

	    }else if(cname=="liver"){
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput=allElements[i];
              	}
			}
			$("."+uclass).val(aInput.value);
			this.hide();
	    }else if(cname=="xgnewsid"){
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true)
				{
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择新闻！");
				return false;
			}
			result=$("."+uclass).val();
			for(var j=0;j<aInput.length;j++){
			    if(j==0){
				    if(result==""){
					   result+=aInput[j].value;
				    }else{
						result+=","+aInput[j].value;
				    }
				}else{
				    result+=","+aInput[j].value;
				}
			}
			$("."+uclass).val(result);
			this.hide();
	    }else if(cname=="shop"){
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true){
                   	aInput.push(allElements[i]);
              	}
			}
			if(aInput.length==0){
				alert("请选择商品！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){
				//result+='<a href="gamedetailhttp:'+aInput[j].value+'">'+aInput[j].id+'</a>';
				result+='<script>var shop_json="'+aInput[j].id+'";</script>';
                  //result+='<iframe src="http://'+(aInput[j].id==1 ? "ali213.fhyx.hk" : "shop.ali213.com")+'/api/union_widget/shopid/'+aInput[j].value+'" frameborder="0" width="100%" height="186"></iframe>';

			}
			insertpagebreak(uclass,result);
			this.hide();
	    }else if(cname=="picedit"){
			window.top.art.dialog.open(url,{id:form_id,title:title,width: '30%', height: '35%', left: '60%', top: '40%', fixed: true, resize: true, drag: true,lock:true ,
				okVal:"确定",
				ok:function(){
					var iframe = this.iframe.contentWindow;
					var oTitle=iframe.document.getElementById("title");
					var oContent=iframe.document.getElementById("content");
					$("#title"+uclass).val(oTitle.value);
					$("#content"+uclass).val(oContent.value);
				},
				cancel: true,
				close: function () {
					this.hide();
				}});
		}else{
            allElements =iframe.document.getElementsByTagName("input");
			for(var i=0;i<allElements.length;i++){
              	if(allElements[i].checked==true && allElements[i].type=="checkbox"){
                   	aInput.push(allElements[i]);
              	}
				if(allElements[i].type=="text"){
				     inputtxt = (allElements[i].value);
				}

			}
			if(aInput.length==0){
				alert("请选择要插入的链接！");
				return false;
			}
			for(var j=0;j<aInput.length;j++){

				if(aInput[j].id.indexOf("in.ali213") > 0){
				     result+='<a style="color: #0130fd" target="_blank" title="'+aInput[j].value+'" href="'+aInput[j].id+'">'+inputtxt+'</a>';
				}else
				{
					if(aInput[j].id.indexOf("game.ali213") > 0){
						result+='<p class="n_show_m" style="text-align: left">更多相关讨论请前往：<a style="color: #0130fd" target="_blank" href="'+aInput[j].id+'"><span style="color: #0130fd">'+aInput[j].value+'</span></a><font style="color: #0130fd">论坛</font></p>';
					}else{
						result+='<a target="_blank" href="'+aInput[j].id+'">'+aInput[j].value+'</a>';
					}
				}
			}

			insertpagebreak(uclass,result);
			this.hide();
	    }

	},cancel: true,
	close: function () {
		this.hide();
    }});
   }

}
//插入到编辑器
function insertpagebreak(id,content) {

	var aTag=document.getElementsByTagName("*");
	var obj=[];

	for(var i=0;i<aTag.length;i++){
           if(aTag[i].className==id){
           	     obj.push(aTag[i]);
           }
	}
	var editor = CKEDITOR.instances[obj[0].id];



 console.log( editor.getSelection().getNative());

		editor.insertHtml(content);

}
function html_encode(str)
{
    var s = "";
    if (str.length == 0) return "";
    s = str.replace(/&/g, ">");
    s = s.replace(/</g, "<");
    s = s.replace(/>/g, ">");
    s = s.replace(/ /g, " ");
    s = s.replace(/\'/g, "'");
    s = s.replace(/\"/g, '"');
    s = s.replace(/\n/g, "<br>");
    return s;
}
//解码
function html_decode(str)
{
    var s = "";
    if (str.length == 0) return "";
    s = str.replace(/>/g, "&");
    s = s.replace(/</g, "<");
    s = s.replace(/>/g, ">");
    s = s.replace(/ /g, " ");
    s = s.replace(/'/g, "\'");
    s = s.replace(/"/g, "\"");
    s = s.replace(/<br>/g, "\n");
    return s;
}